package thread.demo.concurrentMap;

import java.util.concurrent.ConcurrentHashMap;

public class ConcurrentMapTest_Put {
  public static void main(String[] args) {
    ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
    
    System.out.println(map.put("a", "b"));
    System.out.println(map.put("a", "c"));
    System.out.println(map.get("a"));
    
    System.out.println("-----------------------------------");
    
    System.out.println(map.putIfAbsent("e", "b"));
    // set  设置失败
    System.out.println(map.putIfAbsent("e", "c"));
    System.out.println(map.get("e"));
  }
}
